fix: prevent duplicate project applications#211
Conversation
|
attached videos and screenshots showing what changes have been made also some CI jobs are failing update it. |
|
Hi! I have updated the PRs and pushed the requested fixes. I also starred the repository. For PR #210, the latest workflows are currently awaiting maintainer approval. |
|
where you have attached screenshots? |
|
Apologies, that's my mistake. I forgot to attach them. I'll upload the requested screenshots and a short demo shortly. Thanks for pointing it out! |
|
Hi! I tried to generate the requested screenshots and video, but I'm currently unable to reproduce the flow locally because the backend doesn't start on my current setup. Could you let me know the expected setup or the exact flow you'd like me to capture? I'll attach the screenshots and demo as soon as I can reproduce it. Thanks! |
|
Thanks for the implementation. The duplicate application check in create_application() looks good, and returning 409 Conflict is the appropriate HTTP response. Before this can be considered complete, there are a few things that should be addressed: Add a database-level unique constraint on (applicant_id, project_id) to prevent race conditions. The current validation only exists at the application layer, so two concurrent requests could still create duplicate records. Once those changes are included, the implementation should fully satisfy the issue requirements. |
|
Hi @nensii21 I've pushed the requested changes: Added a database-level unique constraint on (applicant_id, project_id). I also looked for the existing test infrastructure to add/update tests, but I couldn't find a project test suite (tests/, pytest, or related configuration). If there's a preferred testing setup, I'd be happy to add the requested test there. I also noticed that one of the GitHub Actions checks is currently failing because of an invalid workflow configuration: .github/workflows/frontend-ci.yml I verified that I didn't modify anything under .github, so this seems unrelated to the changes in this PR. Could you please take a look or re-run the checks once it's resolved? Thank you! |
Pull Request
Summary
This pull request prevents users from submitting duplicate applications to the same project by adding backend validation before creating a new application.
Related Issue
Fixes #202
Type of Change
Changes Made
Screenshots (if applicable)
N/A (Backend change)
Testing
Additional testing notes
Checklist
Additional Notes
This implementation adds server-side validation to prevent duplicate project applications and returns a clear 409 Conflict response when a duplicate submission is attempted, while keeping the existing application flow unchanged.